<!--
 * @Author: 吴竹叶 2107206923@qq.com
 * @Date: 2023-10-18 14:26:43
 * @LastEditors: 孙鹏程 2145261508@qq.com
 * @LastEditTime: 2024-02-29 14:03:51
 * @FilePath: \BZ_JT_AnQuanHuanBaoGuanLiApp\src\views\staging\commom\AnnualWork\components\safety\workInfo.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="bg-white">
    <customTitle :is-line="true" bg-color="#3795ff" title="工作内容详情" />
    <div class="d-scroll listInner">
      <div v-for="(item, index) in info" :key="index">
        <custom-details-item :icon="item.icon" :label="item.label" :value="item.value + ''">
          <template #valueSlot>
            <div v-if="item.label !== '附件'" class="desContent" style="word-break: break-all">
              <div v-if="item.label=== '完成情况'">
                <div class="value" :class="{'text-danger':item.value === '未完成','text-success':item.value === '已完成'}">{{ item.value === '-'?'/':item.value }}</div>
              </div>
              <div v-else>
                {{ item.value === '-'?'/':item.value }}
              </div>
            </div>
            <div v-else class="value">
              <el-link v-if="Array.isArray(item.value)" type="primary" @click.stop="openAttachPopUp(item.value)">查看</el-link>
            </div>
          </template>
        </custom-details-item>
      </div>
    </div>
    <attachPopUp ref="attachPopUp" />
  </div>

</template>
<script>
import customDetailsItem from '@/components/globals/custom-details-item.vue'
import commonList from '@/assets/mixin/commonList'

export default {
  components: { customDetailsItem },
  mixins: [commonList],
  props: {
    descList: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      current: '',
      info: [
        { label: '工作内容', value: '/', fieldName: 'workContent', icon: '&#xe611;' },
        { label: '工作来源', value: '/', fieldName: 'sendType', icon: '&#xe61c;' },
        { label: '完成期限', value: '/', fieldName: 'workType', icon: '&#xe617;' },
        { label: '完成情况', value: '/', fieldName: 'isFinish', icon: '&#xe634;' },
        { label: '完成时间', value: '/', fieldName: 'finishTime', icon: '&#xe6a4;' },
        { label: '情况说明', value: '/', fieldName: 'contentDesc', icon: '&#xe67a;' },
        { label: '附件', value: '/', fieldName: '', icon: '&#xe677;' }
      ]
    }
  },
  watch: {
  },
  mounted() {
    const { current } = this.$route.query
    this.current = current || ''
    this.info.forEach(v => { // 安全环保能源消防---attachmentVOList ，碳排放---shareAttachVos
      if (v.label === '附件') {
        v.fieldName = current === '碳排放管理' ? 'shareAttachVos' : 'attachmentVOList'
      }
    })
    this.info.forEach((v) => {
      v.value = this.descList[v.fieldName] !== '' ? this.descList[v.fieldName] : '/'
    })
  },
  methods: {
  }
}
</script>
<style scoped lang="scss">
</style>
